#include <iostream>
#include <unistd.h>
#include <pthread.h>
#include <sys/types.h>

using namespace std;

void* newthread(void*)
{
    while(true)
    {
        cout<<"I am new thread,pid:"<<getpid()<<endl;
        sleep(1);
    }
}

int main()
{
    pthread_t tid;
    pthread_create(&tid,nullptr,newthread,nullptr);

    while(true)
    {
        cout<<"I am main thread,pid:"<<getpid()<<endl;
        sleep(1);
    }

    return 0;
}